/*
 * @Description
 * @Autor: liujinyin
 * @Date: 2021-06-28 18:40:43
 * @LastEditors: liujinyin
 * @LastEditTime: 2021-07-02 17:57:15
 */

package sqls

import (
	"sync"

	"github.com/micro-plat/hydra"
)

var once sync.Once

func init() {
	once.Do(func() {
		hydra.OnReadying(func() {
			//表结构
			hydra.Installer.DB.AddSQL(schemeSql)
		})
	})
}

var schemeSql = `DROP TABLE IF EXISTS sas_secret_conf;
create table sas_secret_conf(
		uid bigint  not null PRIMARY KEY AUTO_INCREMENT  comment '客户编号' ,
		euid varchar(32)  not null    comment '外部用户编号' ,
		md5_secret varchar(256)      comment 'MD5 秘钥' ,
		sha1_secret varchar(256)      comment 'SHA1 秘钥' ,
		sha256_secret varchar(256)      comment 'SHA256 秘钥' ,
		sha512_secret varchar(256)      comment 'SHA512 秘钥' ,
		hmac_secret varchar(256)      comment 'HMAC 秘钥' ,
		aes_secret varchar(256)      comment 'AES 秘钥' ,
		des_secret varchar(256)      comment 'DES 秘钥' ,
		rsa_public_secret text      comment 'RSA 公钥' ,
		rsa_private_secret text      comment 'RSA 私钥' ,
		mer_cert text      comment '商户证书' ,
		spl_cert text      comment '平台/供应商证书' ,
		root_cert text      comment '根证书' ,
		cert_key text      comment 'pfx证书密码' ,

		rsa_type varchar(16) comment 'RSA 类型' ,
		rsa_bits int comment 'RSA密钥长度' ,
		status int default 0 not null    comment '状态(保存枚举值，全部禁用时值为 0)' ,
		expire_time datetime default current_timestamp not null    comment '过期时间' ,
		create_time datetime default current_timestamp not null    comment '创建时间' ,
		update_time datetime default current_timestamp     comment '更新时间' 
				
  )AUTO_INCREMENT=8000,COMMENT='### 信息配置表';

 create unique index sas_secret_conf_ident ON sas_secret_conf(euid);`
